<template>
  <div>
    <el-menu
      active-text-color="#379EFF"
      background-color="#304156"
      class="el-menu-vertical-demo"
      text-color="#fff"
      :collapse="isCollapse"
      router
      unique-opened
      :default-active="rotes.path"
    >
      <el-menu-item index="/index"> 首页 </el-menu-item>
      <el-sub-menu
        :index="'/' + item.name"
        v-for="(item, index) in menus"
        :key="item.id"
      >
        <template #title>
          <i class="iconfont" :class="item.icon"></i>
          <span>{{ item.title }}</span>
        </template>
        <template v-for="(items, MyIndex) in item.children" :key="items.id">
          <el-menu-item
            :index="'/' + item.name + '/' + items.name"
            v-if="items.hidden === 0"
          >
            <i class="iconfont" :class="items.icon"></i>
            {{ items.title }}</el-menu-item
          >
        </template>
      </el-sub-menu>
    </el-menu>
  </div>
</template>

<script setup lang="ts">
import { inject, computed } from "vue";
import {
  Document,
  Menu as IconMenu,
  Location,
  Setting,
} from "@element-plus/icons-vue";
import { useStore } from "../../store/login";
import { useRoute } from "vue-router";
const rotes = useRoute();
console.log(rotes.path);

const store = useStore();
const menus = store.rotes;
const handleOpen = (key: string, keyPath: string[]) => {
  console.log(key, keyPath);
};
const handleClose = (key: string, keyPath: string[]) => {
  // console.log(key, keyPath);
};
const isCollapse = inject("isCollapse");

// type menus=
</script>

<style scoped></style>
